﻿<Application xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:sdk="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
             x:Class="SilentWebsite.App">
    <Application.Resources>
        
        <!-- Effect -->
        <DropShadowEffect x:Key="ChildWindowDropShadow" ShadowDepth="0.5" BlurRadius="15" Opacity="0.4"/>
        
        <!-- Gradients -->
        <Color x:Key="GradientBandColorStart">#ff6699ff</Color>
        <Color x:Key="GradientBandColorEnd">#996699ff</Color>
        <LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5" x:Key="HorizontalGradientBand">
            <GradientStop Color="{StaticResource GradientBandColorStart}" Offset="0" />
            <GradientStop Color="{StaticResource GradientBandColorEnd}" Offset="1" />
        </LinearGradientBrush>
        <SolidColorBrush x:Key="TextNormalBrush" Color="#FF5B5B5B"/>
        
        <Style TargetType="TextBlock" x:Key="BaseTextStyle">
            <Setter Property="Foreground" Value="{StaticResource TextNormalBrush}"/>
            <Setter Property="FontFamily" Value="Segoe UI, Tahoma, Arial"/>
        </Style>
        <Style TargetType="TextBlock" x:Key="PopupTitle" BasedOn="{StaticResource BaseTextStyle}">
            <Setter Property="FontSize" Value="30"/>
        </Style>
        <Style x:Key="ChildWindowStyle" TargetType="sdk:ChildWindow">
            <Setter Property="IsTabStop" Value="False"/>
            <Setter Property="FontFamily" Value="Segoe UI, Tahoma, Arial"/>
            <Setter Property="FontSize" Value="13"/>
            <Setter Property="TabNavigation" Value="Cycle"/>
            <Setter Property="HorizontalAlignment" Value="Center"/>
            <Setter Property="VerticalAlignment" Value="Center"/>
            <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
            <Setter Property="VerticalContentAlignment" Value="Stretch"/>
            <Setter Property="BorderThickness" Value="0"/>
            <Setter Property="BorderBrush" Value="Transparent"/>
            <Setter Property="OverlayBrush" Value="#AFFFFFFF"/>
            <Setter Property="OverlayOpacity" Value="1"/>
            <Setter Property="Background">
                <Setter.Value>
                    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                        <GradientStop Color="White" Offset="0"/>
                        <GradientStop Color="#FFF1F1F1" Offset="1"/>
                    </LinearGradientBrush>
                </Setter.Value>
            </Setter>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="sdk:ChildWindow">
                        <Grid x:Name="Root">
                            <Grid.Resources>
                                <ExponentialEase EasingMode="EaseIn" Exponent="-5" x:Key="ProjectionEasingFunction"/>
                            </Grid.Resources>
                            <VisualStateManager.VisualStateGroups>
                                <VisualStateGroup x:Name="WindowStates">
                                    <VisualState x:Name="Open">
                                        <Storyboard>
                                            <DoubleAnimationUsingKeyFrames BeginTime="0" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="Overlay">
                                                <EasingDoubleKeyFrame KeyTime="0" Value="0"/>
                                                <EasingDoubleKeyFrame KeyTime="00:00:00.3" Value="1"/>
                                            </DoubleAnimationUsingKeyFrames>
                                            <DoubleAnimationUsingKeyFrames BeginTime="0" Storyboard.TargetProperty="(RenderTransform).(Children)[0].ScaleX" Storyboard.TargetName="ContentRoot">
                                                <SplineDoubleKeyFrame KeyTime="0" Value="1"/>
                                            </DoubleAnimationUsingKeyFrames>
                                            <DoubleAnimationUsingKeyFrames BeginTime="0" Storyboard.TargetProperty="(RenderTransform).(Children)[0].ScaleY" Storyboard.TargetName="ContentRoot">
                                                <SplineDoubleKeyFrame KeyTime="0" Value="1"/>
                                            </DoubleAnimationUsingKeyFrames>
                                            <DoubleAnimationUsingKeyFrames 
												BeginTime="0"  
												Storyboard.TargetProperty="(UIElement.Projection).(PlaneProjection.RotationX)" 
												Storyboard.TargetName="ContentRoot">
                                                <EasingDoubleKeyFrame KeyTime="0" Value="-90" EasingFunction="{StaticResource ProjectionEasingFunction}"/>
                                                <EasingDoubleKeyFrame KeyTime="00:00:00.5" Value="0" EasingFunction="{StaticResource ProjectionEasingFunction}"/>
                                            </DoubleAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </VisualState>
                                    <VisualState x:Name="Closed">
                                        <Storyboard>
                                            <DoubleAnimationUsingKeyFrames BeginTime="0" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="Overlay">
                                                <EasingDoubleKeyFrame KeyTime="0" Value="1"/>
                                                <EasingDoubleKeyFrame KeyTime="00:00:00.2" Value="0"/>
                                            </DoubleAnimationUsingKeyFrames>
                                            <DoubleAnimationUsingKeyFrames BeginTime="0" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="ContentRoot">
                                                <EasingDoubleKeyFrame KeyTime="0" Value="1"/>
                                                <EasingDoubleKeyFrame KeyTime="00:00:00.2" Value="0"/>
                                            </DoubleAnimationUsingKeyFrames>
                                            <DoubleAnimationUsingKeyFrames 
												BeginTime="0"  
												Storyboard.TargetProperty="(UIElement.Projection).(PlaneProjection.RotationX)" 
												Storyboard.TargetName="ContentRoot">
                                                <EasingDoubleKeyFrame KeyTime="0" Value="0" EasingFunction="{StaticResource ProjectionEasingFunction}"/>
                                                <EasingDoubleKeyFrame KeyTime="00:00:00.2" Value="-90" EasingFunction="{StaticResource ProjectionEasingFunction}"/>
                                            </DoubleAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </VisualState>
                                </VisualStateGroup>
                            </VisualStateManager.VisualStateGroups>
                            <Grid 
								x:Name="Overlay" 
								Background="{TemplateBinding OverlayBrush}" 
								HorizontalAlignment="Stretch" 
								Margin="0" 
								Opacity="{TemplateBinding OverlayOpacity}" 
								VerticalAlignment="Top"/>
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="1*"/>
                                    <ColumnDefinition Width="8*"/>
                                    <ColumnDefinition Width="1*"/>
                                </Grid.ColumnDefinitions>
                                <Grid x:Name="ContentRoot" 
									Grid.Column="1"
									HorizontalAlignment="{TemplateBinding HorizontalAlignment}" 
									RenderTransformOrigin="0.5,0.5" 
									VerticalAlignment="{TemplateBinding VerticalAlignment}" 
									Margin="1,0,-1,0">
                                    <Grid.Projection>
                                        <PlaneProjection RotationX="0"/>
                                    </Grid.Projection>
                                    <Grid.RenderTransform>
                                        <TransformGroup>
                                            <ScaleTransform/>
                                            <SkewTransform/>
                                            <RotateTransform/>
                                            <TranslateTransform/>
                                        </TransformGroup>
                                    </Grid.RenderTransform>
                                    <Grid Background="{TemplateBinding Background}" Effect="{StaticResource ChildWindowDropShadow}"/>
                                    <Grid Margin="30,16,30,30">
                                        <Grid.RowDefinitions>
                                            <RowDefinition Height="15"/>
                                            <RowDefinition Height="Auto"/>
                                            <RowDefinition/>
                                        </Grid.RowDefinitions>

                                        <Rectangle 
											VerticalAlignment="Bottom"
											HorizontalAlignment="Left"
											Grid.Row="0" 
											Fill="{StaticResource HorizontalGradientBand}" 
											Width="109"
											Height="6"/>

                                        <TextBlock 
											Grid.Row="1"
											Margin="0,0,0,12"
											VerticalAlignment="Top"
											Style="{StaticResource PopupTitle}"
											Text="{TemplateBinding Title}" />

                                        <ContentPresenter 
											Grid.Row="2"
											x:Name="ContentPresenter" 
											ContentTemplate="{TemplateBinding ContentTemplate}" 
											Content="{TemplateBinding Content}" 
											HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" 
											VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
											Margin="0"/>

                                        <!-- no close button in my template -->
                                    </Grid>
                                </Grid>
                            </Grid>
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </Application.Resources>
</Application>
